<template>
  <!-- 关键功能：包装 var-loading，支持 v-model:show 与插槽内容 -->
  <var-loading :loading="internalShow" :description="description">
    <slot />
  </var-loading>
</template>

<script>
export default {
  name: 'Loading',
  props: {
    show: { type: Boolean, default: false },
    description: { type: String, default: 'LOADING' }
  },
  emits: ['update:show'],
  data() {
    return {
      // 关键功能：内部状态与外部 v-model 同步
      internalShow: this.show
    }
  },
  watch: {
    show(val) {
      this.internalShow = val
    },
    internalShow(val) {
      if (val !== this.show) this.$emit('update:show', val)
    }
  }
}
</script>

<style scoped>

</style>